package com.csx.orm.mybatis.diy.annotation;

import java.lang.annotation.*;
import java.util.Date;
import java.util.UUID;

/**
 * <p> what does this class do ? </p>
 * <p> How does it work ?</p>
 * <p> Why does it do this ?</p>
 *
 * @author cuisongxu
 * @date 2023/11/30 周四 14:37
 */
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Id {

    Class<? extends IdGenerator> generateStrategy() default DateGenerator.class;

    interface IdGenerator<T> {

        T next();
    }

    class DateGenerator implements IdGenerator<Long> {
        @Override
        public Long next() {
            return new Date().getTime();
        }
    }
}
